A generalized factory in C++ that allows products to register themselves to the factory and the factory to build them