How to pass struct from one class to another

Hi,

I want to pass struct from one class to another but getting error. Is this legal?

class seq;
  typedef struct {
      bit [2:0] t1;
      bit [2:0] t2;
    }t;
  
  t st_t;
  
  task display_id();
    $display("t1%b t2 %b",st_t.t1, st_t.t2);
  endtask
  
  
endclass

class a;
    
    typedef struct {
      bit [2:0] t1;
      bit [2:0] t2;
    }t;
    
    t st_t;
  
   seq seq_inst=new();
  
    function new();
      stress_hostid.t1= 2;
      stress_hostid.t2= 3;
      seq_inst.st_t = st_t;
    endfunction

    

   **ERROR - Incompatible complex type assignment
  Type of source expression is incompatible with type of target expression. 
  Mismatching types cannot be used in assignments, initializations and 
  instantiations.
  endclass

In reply to UVM_SV_101:

You’ve declared two separate typedefs in two separate classes. Declare one typedef outside of the classes, in a single package preferably.