Overload the + operator to add an object with int : <p>I have just learned operator overloading and I am having trouble overloading the '+' operator to add an object with int. I am also not sure with how to overload the '&lt;&lt;' to output an object. </p>

<p>Any advice or help would be greatly appreciated.</p>

<pre><code>#include&lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;
using namespace std;

class CLOCK
{
public:
    int h, m, s;
    CLOCK()
    {
        h = 0;
        m = 0;
        s = 0;
    }
    CLOCK(int hour, int minute, int second)
    {
        hour = h;
        minute = m;
        second = s;
    }

    CLOCK operator+(int time)
    {
        CLOCK c(*this);
        c.m += time;
        return c;
    }

    CLOCK operator++(int)
    {
        CLOCK c(h,m,s);
        h++;
        return c;
    }
    friend ostream &amp;operator&lt;&lt;(ostream &amp;output, const CLOCK &amp;c)
    {
        output &lt;&lt; c.h &lt;&lt; c.m &lt;&lt; c.s &lt;&lt; endl;
        return output;
    }
};

int main()

{

    CLOCK c(10, 10, 10);

    cout &lt;&lt; c &lt;&lt; endl; // should display 101010

    c = c + 10; // should display 10 minutes to my clock

    cout &lt;&lt; c.hour &lt;&lt; c.minute &lt;&lt; c.second &lt;&lt; endl;  // should display 102010

    c++; // this should increment hours, time now is 012010
    system("pause");
}
</code></pre>
