Use std::shared_ptr instead of a raw pointer.