This is neither safe (you can still get raw pointers/references to its contents) nor garbage collection in the usual sense (you can't even share it!)
This is assuming people don’t abuse it and pass around raw references/pointers to it (they will). The safest construct, though with definite performance impact, is std::shared_ptr but people think they are smarter than they are and don’t use it.
If your object graph is a tree then you're using the most trivial <10% of the garbage collector.