#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main(int argc, char ** argv){
    filebuf fb;
    fb.open ("test.txt",ios::out);
    std::ostream os(&fb);
    std::string test("test");
    os << test; // This line has the problem
    fb.close();
}