title: How do I use a class wstringstream variable?
body: <p>I have a <code>std::wstringstream</code> that I'm using as sort of a buffer in my class and it is used by a good portion of the methods in this class. However, when I try to do something like this:</p>
  
  <pre><code>#include &lt;sstream&gt;
  
  class foo
  {
    public:
      void methodA(int x, int y); // Uses mBufferStream
      void methodB(int x, int y); // Uses mBufferStream
  
    private:
      std::wstringstream mBufferStream;
  };
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>error C2248: 'std::basic_ios&lt;_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios&lt;_Elem,_Traits>'</p>
  </blockquote>
  
  <p>This isn't my exact class obviously, but it is the same setup. Any thoughts as to what I may be doing wrong? I am using Microsoft Visual Studio 2005.</p>
  
  <p>[Edit] showing use in method body in .cpp file (as an example of it's use):</p>
  
  <pre><code>void foo::methodA(int x, int y)
  {
    mBufferStream &lt;&lt; "From " &lt;&lt; x &lt;&lt; " To " &lt;&lt; y;
    externalfunction(mBufferStream.str());  // Prints to message service
    mBufferStream.str(L"");
  }
  </code></pre>