make smart_ptr a method of class_ instead of a global