Static initialization with private constructor
<p>In a class I have a static member that represents the singleton instance of that class:</p>

<pre><code>class A {
public:
  static const std::shared_ptr&lt;A&gt; INSTANCE;
private:
  A();
};
</code></pre>

<p>In order to prevent more instances I made the constructor private. Now I have trouble to initialize the static var, because the initializer cannot access a private member. Here's the code I use in the .cpp file:</p>

<pre><code>const std::shared_ptr&lt;A&gt; A::INSTANCE = std::make_shared&lt;A&gt;();
</code></pre>

<p>A factory method wouldn't help either, as it would have to be public as well. What else can I do to make this work? Note: I'd like to avoid the typical <code>static get()</code> method if possible.</p>