Use static reference instead of pointer, otherwise the destructor of Factory will not be called (GCC).