operator< error in priority queue : <p>I am facing "binary '&lt;': no operator found which takes a left-hand operand of type 'const Baloons' (or there is no acceptable conversion)" error and I cannot find any solution?</p>

<p>I would also like to ask how can I order the priority queue by baloon.end?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;queue&gt;
#include &lt;vector&gt;

using namespace std;

class Baloons
{
public:
    float start;
    float end;

public:
    Baloons() {}
    Baloons(float start, float end) : start{ start }, end{ end } {}
};

int main()
{
Baloons baloon1(1, 5);
Baloons baloon2(4, 7);
Baloons baloon3(6, 9);
Baloons baloon4(11, 12);
std::priority_queue&lt;Baloons&gt; myBaloons;
myBaloons.push(baloon1);
myBaloons.push(baloon2);
myBaloons.push(baloon3);
myBaloons.push(baloon4);
while (!myBaloons.empty())
{
    Baloons b = myBaloons.top();
    cout &lt;&lt; b.start &lt;&lt; " -&gt; " &lt;&lt; b.end &lt;&lt; " ";
    myBaloons.pop();
}
system("pause");
return 0;
</code></pre>

<p>}</p>
