How to use sort() within a class

hello!
I am stuck with this problem.
See the code below

class BuildingHeightsEasy

{

public:

struct node

{

int val;

int i;

};

bool myf(node p,node q)

{

return p.val<q.val;

}

int minimum(int M, vector > heights)

{

vector v;

sort(v.begin(),v.end(),myf); //THIS IS THROWING AN ERROR

}

if this is out of the class,then program is successfully compiled.Whats the problem??