A basic implementation of smart pointers and reference counting