The left operand of >> will always be an istream and the right operand will be
whatever we want :

#include <iostream>
class Crazy {
double a, b;
istream & operator >> (istream &i, Crazy &c) {
return i >> (c.a) >> (c.b);
int main(int argc, char **argv) {
Crazy x;
cin >> x;

The ostream can not be copied, and will always exist as a lvalue (by definition
printing modifies its state), so you have to alway pass it by reference and return
a reference :

#include <iostream>
void dumb1(ostream &s) {}
void dumb2(ostream s) {}
int main(int argc, char **argv) {
‘ios::ios(const ios &)’ is private

Here the line 8 tries to pass the stream by value, thus to call a copy constructor,
which is private.
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates