Here's my toy program. It fails to compile with error message " no operator << matches these operands". Any help will be appreciated.
struct foo {
std::string name;
};
std::ostringstream& operator<<(std::ostringstream& os, const foo& info)
{
os << info.name;
return os;
}
void insert(const foo& info)
{
std::ostringstream os;
os << "Inserted here " << info; // don't work here
}
int main()
{
foo f1;
f1.name = "Hello";
insert(f1);
}