Can somebody help me? Im getting this error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream}' and 'Rectangle')
#include <iostream>
using namespace std;
template <typename T>
T higher(T a, T b)
{
return a > b ? a : b;
}
class Rectangle
{
private:
double a,b;
public:
Rectangle(double x, double y)
{
a=x;
b=y;
}
double GetP()
{
return a*b;
}
friend bool operator>(Rectangle, Rectangle);
};
bool operator>(Rectangle p1, Rectangle p2)
{
if(p1.GetP() > p2.GetP())
{
return true;
}
return false;
}
int main()
{
Rectangle p1(2,4),p2(3,6);
cout << higher(p1,p2) << endl;
}
It has to print higher surface of 2 rectangles. I cant figure out problem.