how serialize my object?
I'm not an expert in this topic but for what I know, it depends, there are many ways, starting with manual serialization from a member function to using some complex stuff like protobuf.
You can have a look at boost::serialization, if using boost is fine.
I heard of some people who used llvm to generate serialization/deserialization code.
For some of my components I use python to generate C++ code of serialization/deserialization.
Also you can have a look at visitor pattern that sometimes used for serialization.
And one thing that have bitten me a couple of times: if you serialize data that can be used by newer versions of your application, think about how you going to upgrade your serialized data in advance (some formats are very bad at that).