title: How to solve the crash when smart pointer uses the structure in the class？
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;memory&gt;
  class CTest {
   public:
    struct StructTest {
      std::string StrTest;
    };
  };
  int main() {
    std::shared_ptr&lt;CTest::StructTest&gt; opt;
    opt-&gt;StrTest = &quot;hello world\n&quot;;
    std::cout &lt;&lt; opt-&gt;StrTest;
    return 0;
  }
  </code></pre>
  <p>This code is so simple, but it crashes. I can't understand why smart pointer can't use it like this.</p>