It’s somewhat annoying that a factory needs to depend on all classes that inherit from the common interface. This issue can be avoided using a self-registering factory.
Serialisation into human readable formats tends to be a tedious task in programming languages without a lot of reflection. Here is a trick to make it far less repetitive in C++.