Small implementation of auto pointer with reference count