sending std::ostream& as parameter in serializer. The ostream can be a file, console, socket, etc.