Pregunta de entrevista de Frontier Developments

How to implement a garbage collection system in C++ (eg: implement shared_ptr, ect)?