Here's my code. This runs, but it gives me an error when I remove the const from ostream& operator<< . Why?
As a side question, the error message shown is: cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to 'std::basic_ostream&&' . How does this indicate that I'm missing a const?
#include <iostream>
using namespace std;
class pair_int{
public:
    int x;
    int y;
    pair_int(int x, int y):x(x),y(y){};
    friend ostream& operator<< (ostream & s, pair_int & c);
};
ostream& operator<<(ostream & s, const pair_int & c){
    s << c.x;
    s << ",";
    s << c.y;
    return s;
}
pair_int square(int x){
    return pair_int(x, x*x);
}
int main(int argc,char * argv []){
    int x;
    cin >> x;
    cout << square(x);
  return 0;
}
 
    