I've a question and I hope you know the answer. I've a generic heap class. Lets call it ***CHeap***. In this class, due to the nature of the heap, I need to compare the components (for example `Heap[i]>Heap[j]`). Here ***Heap*** is an ***array***.

If I define a variable like this in my ***main.cpp***:

```
cHeap <int> myHeap;

```

then I have no problem. But if I have a data structure, let's say:

```
struct S{
 int data;
 int code;
}

```

and I define:

```
cHeap <S> myHeap;

```

then I have problem. For example, I want the comparison be on ***code*** values. in other words: `Heap[i].code>Heap[j].code` 

But, as I said before, this is a generic class and I don't want to have that in my code (in my ***CHeap*** class). Is there anyway that I can overload the ***operator>*** for ***CHeap*** in my ***main.cpp***?
In other words having:

```
bool operator>(const S& s1, const s& s2){
    return s1.code > s2.code;
}

```

in my ***main.cpp*** and link it to the ***CHeap*** class?

Something like what we do when we use STL's **\*priority\_queue\***:

```
priority_queue <S, vector <S>, greater <S> > myPQ;

bool operator>(const S& s1, const s& s2){
    return s1.code > s2.code;
}

```

?!

Thanks