Mingw, wcout and locales
This is a somewhat old question, but I have an alternative that may work for this.  Related to this question, if you turn off the synchronization with the underlying stdio, you can use imbue to set the locale for both wcout and wcin:

#include &lt;locale&gt;
#include &lt;string&gt;
#include &lt;iostream&gt;

int main ()
{
    // this code turns off the sync with stdio
    std::ios_base::sync_with_stdio(false);
    // now create the appropriate locale without setting the global one
    std::locale ru("ru_RU.utf8");
    // use imbue to allow the Russian words to be properly displayed
    std::wcout.imbue(ru);
    // ... and input
    std::wcin.imbue(ru);

    // the rest of the code is essentially unchanged from the original
    std::wstring s(L"привет");
    std::wcout &lt;&lt; s &lt;&lt; '\n';
    std::wstring u; 
    std::wcin &gt;&gt; u;
    s += L' ' + u;
    std::wcout &lt;&lt; s &lt;&lt; '\n';
 }


Using it in this way means that no custom class is required.