How could I call module task in class task member?

IUS compiler and VCS compiler can’t compile such file.
but questasim verilog can compile.

Is there another method to use such function in all simulators?