Hello everyone I am trying to implement a pair like Template. I have tried this:
#include<iostream>
using namespace std;
template<class T1, class T2>
class Pair
{
    //defining two points
    public:
    T1 first;
    T2 second;
    //default constructor
    Pair():first(T1()), second(T2())
    {}
    //parametrized constructor
    Pair(T1 f, T2 s) : first(f),second(s)
    {}
    //copy constructor
    Pair(const Pair<T1,T2>& otherPair) : first(otherPair.first), second(otherPair.second)
    {}
    //overloading == operator
    bool operator == (const Pair<T1, T2>& otherPair) const
    {
        return (first == otherPair.first) && (second == otherPair.second);
    }
    //overloading = operator
    Pair<T1, T2> operator = (const Pair<T1, T2>& otherPair) 
    {
        first=otherPair.first;
        second=otherPair.second;
        return this;
    }
    int main()
    {
        Pair<int, int> p1(10,20);
        Pair<int, int> p2;
        p2 = p1;
    }
But I am getting the error in the last line of  the overloaded method =. It is not allowing to return the this object. 
Can anyone help where i am doing wrong?
 
    