I have been using "Accelerated C++" to learn C++ over the summer, and there's a concept which I don't seem to understand properly.
Why is
int x;
if (cin >> x){}
equivalent to
cin >> x;
if (cin){}
By looking at the code, it seems to me that we're using cin as a variable. But, I thought it was a function. Why can we use cin in this way when it is x that has whatever value we input into our keyboard?