I am learning to use the priority queue container in c++. The third argument it takes determines how it will prioritize its elements.
Why does the third argument has to be a class or a struct? Why can't it be a simple function?

For eg: - I am having a priority queue for integers. I have some special priority function.

I can't just make a function like the one below and pass it as the argument
Code:
bool my_comp (int a, int b)
{
         return a < b;
}
I have to make a struct as below and then pass it.
Code:
struct my_comp
{
         int operator (int a, int b) { return a < b; }
}
Why do we have to pass a struct or a class? Why not a simple function?