You didn’t say how you compiled my_class when you split up the files, but I’m assuming you compiled it with each module. Then you get three independent types of my_class. Although they have the same name, they are independent class types because the full name of any user defined type includes the scope containing the declaration. The scope outside of a module is called $unit, and each file has a unique compilation unit scope. You need to put the class declaration in a package and import the package into each module declaration. See SystemVerilog Coding Guidelines: Package import versus `include - Verification Horizons .
Dave