Option 1: Make the custom allocator a friend of your class.
Option 2: Delegate the actual allocation job in the custom allocator to a non-member function, and make that specific non-member function a friend of your class.
Option 2b: Delegate the actual allocation job in the custom allocator to a non-member function, and specialize the non-member function to call Mesh::InitializeMesh
(or what have you) instead of Mesh::Mesh
.
Option 3: Create a version of AllocateObject
that also takes an initialization functor, allowing the caller to pass in how the memory block is to be initialized. The default initialization functor would take any number of args and call placement new. The one you'd pass in in this case might do the same (but be a friend of the class), or it might be a pointer to some static method in Mesh
, or what have you.