c++ program that returns half of an object : <p>I am new to c++ and learning it. I am writing a simple program that returns half of an object. My code looks something like</p>

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

template &lt;class T&gt;
double half(int x)
{
  double h = x / 2;
  return h;
}

class TuitionBill
{
   friend ostream&amp; operator+(ostream, TuitionBill);
   private:
      string student;
      double amount;
   public:
      TuitionBill(string, double);
      double operator/(int);
};

TuitionBill::TuitionBill(string student, double amt)
{
   student = student;
   amount = amt;
}

double TuitionBill::operator+(int factor)
{
   double half = amount / factor;
   return half;
}

ostream&amp; operator+(ostream&amp; o, TuitionBill&amp; t)
{
   o &lt;&lt; t.student &lt;&lt; "  Tuition: $" &lt;&lt; t.amount &lt;&lt; endl;
   return o;
}

int main()
{
   int a = 47;
   double b = 39.25;
   TuitionBill tb("Smith", 4000.00);
   cout &lt;&lt; "Half of " &lt;&lt; a &lt;&lt; " is " &lt;&lt; half(a) &lt;&lt; endl;
   cout &lt;&lt; "Half of " &lt;&lt; b &lt;&lt; " is " &lt;&lt; half(b) &lt;&lt; endl;
   cout &lt;&lt; "Half of " &lt;&lt; tb &lt;&lt; " is " &lt;&lt; half(tb) &lt;&lt; endl;
   return 0;
}
</code></pre>

<p>What is wrong in here? I want to learn this program. Can anyone guide me through this ? I want to use template function here.</p>
