#include <iostream>
#include <memory>
using namespace std;

template<typename T>
struct MyShared : public std::shared_ptr<T>
{ }; 

struct X {
	int n_;
	X(int n) : n_(n) { }
	~X() { cout << "~X " << n_ << "\n"; }
};

int main() {
	MyShared<X> p;
	p.reset(new X(3));
}