#include <iostream>
#include <memory>
using namespace std;
class Foo : public enable_shared_from_this<Foo>
{
public:
  void Test()
  {
    auto sp = shared_from_this();
    cout << sp.use_count() <<endl;
  }
};

int main()
{
  Foo f;
  f.Test();
  return 0;
}