title: Why is #include <string> preventing a stack overflow error here?
body: <p>This is my sample code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class MyClass
  {
      string figName;
  public:
      MyClass(const string&amp; s)
      {
          figName = s;
      }
  
      const string&amp; getName() const
      {
          return figName;
      }
  };
  
  ostream&amp; operator&lt;&lt;(ostream&amp; ausgabe, const MyClass&amp; f)
  {
      ausgabe &lt;&lt; f.getName();
      return ausgabe;
  }
  
  int main()
  {
      MyClass f1("Hello");
      cout &lt;&lt; f1;
      return 0;
  }
  </code></pre>
  
  <p>If I comment out <code>#include &lt;string&gt;</code> I don't get any compiler error, I guess because it's kind of included through <code>#include &lt;iostream&gt;</code>. If I <em>"right-click --> Go to Definition"</em> in Microsoft VS they both point to the same line in the <code>xstring</code> file:</p>
  
  <pre><code>typedef basic_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt;
      string;
  </code></pre>
  
  <p>But when I run my program, I get an exception error:</p>
  
  <blockquote>
    <p>0x77846B6E (ntdll.dll) in OperatorString.exe: 0xC00000FD: Stack overflow (Parameter: 0x00000001, 0x01202FC4)</p>
  </blockquote>
  
  <p>Any idea why I get a runtime error when commenting out <code>#include &lt;string&gt;</code>? I'm using VS 2013 Express.</p>