C++map容器使用出现报错,不知道什么问题

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
void printMap(map<int,int>& m)
{
    for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
    {
        cout << "key = " << it->first << "value = " << it->second;
        cout << endl;
    }
    cout << endl;
}
class MyCompare
{
public:
    bool operator ()(int v1, int v2)const
    {
        return v1 > v2;
    }
};
void test02()
{
    map<const int, const int, MyCompare> m;
    m.insert(make_pair(1, 10));
    m.insert(make_pair(2, 20));
    m.insert(make_pair(3, 30));
    m.insert(make_pair(4, 40));
    m.insert(make_pair(5, 50));
    printMap(m);
}
int main()
{
    test02();
}

这段在printMap(m)时会报错,不清楚为什么

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
using namespace std;

class MyCompare
{
public:
    bool operator ()(int v1, int v2)const
    {
        return v1 > v2;
    }
};

void printMap(map<int,int,MyCompare>& m)
{
    for (map<int, int,MyCompare>::iterator it = m.begin(); it != m.end(); it++)
    {
        cout << "key = " << it->first << "value = " << it->second;
        cout << endl;
    }
    cout << endl;
}

void test02()
{
    map<int, int, MyCompare> m;
    m.insert(make_pair(1, 10));
    m.insert(make_pair(2, 20));
    m.insert(make_pair(3, 30));
    m.insert(make_pair(4, 40));
    m.insert(make_pair(5, 50));
    printMap(m);
}
int main()
{
    test02();
}

把, MyCompare去掉