<pre><code>int main()
{
    HandPhone A,B;
    A&gt;&gt;B;//overloading operator&gt;&gt; to simulate sending sms to another handphone(object)
    return 0;
}
</code></pre>

<p>How should I declare the istream operator to simulate sending sms to another handphone(object)?</p>

std::istream
is a class, not an operator.  The << and >> operators can be defined for any two types:
```
```
class A;
class B;

A operator << (A& a, const B& b)    // a << b;  sends b to a.
{
   a.sendMessage(b);
   return a;
}
```
```