#include #include #include using namespace std; using namespace boost::archive; class Nested { public: explicit Nested() : mC() { } explicit Nested(char c) : mC(c) { } private: friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int) { using boost::serialization::make_nvp; ar & make_nvp("c", mC); }; private: char mC; }; BOOST_CLASS_VERSION(Nested, 0); int main() { Nested n('c'); { using boost::serialization::make_nvp; xml_oarchive ar(cout); ar << make_nvp("Nested", n); } return 0; }