Obviously, the standard library provided operator does not know what to do with your user defined type mystruct
. It only works for predefined data types. To be able to use it for your own data type, You need to overload operator <<
to take your user defined data type.