请问这个怎么改错呢?尤其是访问私有那个部分

#include
using namespace std;
class Date
{
public:
Date(int y=0,int m=0,int d=0)
{
year=y;
month=m;
day=d;
}
void operator=(Date &date);
void output=(){cout<
bool operator>(Date d1,Date d2);
private:
int year,month,day;
};
void operator=(Date &date)
{
year=date.year;
month=date.month;
day=date.day;
}
bool operator>(Date d1,Date d2)
{
bool flag=false;
if(d1.year>d2.year)flag=true;
else if(d1.year==d2.year)
if(d1.month>d2.month)flag=true;
else if(d1.month==d2.month)
if(d1.day>d2.day)flag=true;
return flag;

}
void main()
{
Date date1(2017,4,27);
Date date2(2018,4,27),date3;
date3=date1;
cout<<"date3;";
date3.output();
cout<<"date2>date3 is";
cout<date3);


class Date
{
public:
    Date(int y = 0, int m = 0, int d = 0)
    {
        year = y;
        month = m;
        day = d;
    }
    Date &operator=(const Date &date); //
    void output() { cout << year << "," << month << "," << day << endl; }
    bool operator>(const Date &d2); //

private:
    int year, month, day;
};
Date &Date::operator=(const Date &date) //
{
    year = date.year;
    month = date.month;
    day = date.day;
    return *this;
}
bool Date::operator>(const Date &d2) //
{
    if (year != d2.year)
        return year > d2.year;
    if (month != d2.month)
        return month > d2.month;
    return day > d2.day;
}
int main()
{
    Date date1(2017, 4, 27);
    Date date2(2018, 4, 27), date3;
    date3 = date1;
    cout << "date3;";
    date3.output();
    cout << "date2>date3 is";
    cout << boolalpha << (date2 > date3);
}