In C++, for output, we usually write cout<<x;
But if we want to write in reverse-> x>>cout;
Same case for cin. Instead of cin>>x, if we want to write x>>cin.
We can do it in class.
#include<bits/stdc++.h>
using namespace std;
class number{
int x;
public:
number(){}
number(int x):x(x){};
istream& operator>>(istream& in){
cin>>x;
return in;
}
ostream& operator<<(ostream& out){
cout<<x;
return out;
}
};
int main(){
number n;
n>>cin;
n<<cout;
return 0;
}








It's called Operator overloading.
Yes, Exactly! If we don't use friend function, then
coutandcinare written later for member function.