Implementation of a smart pointer