Passing queue of structs by ref

You have two unpacked struct declarations. It does not matter that they have the same field layout—they are not assignment compatible. And because at least one of the fields is a string type, you cannot do a bit-stream cast between them.

Unpacked structs variables are only assignment compatible if they share the same single typedef. You need to put the struct typedef in a common package and import the package in both places you use the struct.

See SystemVerilog Coding Guidelines: Package import versus `include - Verification Horizons

Also, I suggest using a function void instead of a task unless your routine needs to consume time. And use an output instead of a ref argument. See Passing arguments by reference