Get actual class when serializing structs