C++ nested class allocation for reclaiming memory