title: priority queue of custom class
body: <p>I am trying to add a user-defined plane object to a priority queue:</p>
  
  <pre><code>int main( ) 
  
  {
  
   std::string filename;
   cout &lt;&lt; "Enter file name &gt;&gt; ";
   getline( cin, filename );
  
   ifstream fin;
   fin.open( filename.c_str( ) );
   if( fin.fail( ) )
   {
        cout &lt;&lt; "Unable to open the input file" &lt;&lt; endl;
        exit(1);
  
   }
  priority_queue&lt;Plane*,vector&lt;Plane*&gt;,greater&lt;Plane*&gt; &gt; pq;
  Plane * p1;
   while(fin)
   {
        fin.get( );
          fin &gt;&gt; *p1;
          pq.push(*p1);
  
   }
   Plane p;
   int size=pq.size();
   for(int i=0;i&lt;3;i++)
   {
       p=pq.top();
       cout&lt;&lt;i&lt;&lt;" "&lt;&lt;p;
       pq.pop();
   }
  }
  </code></pre>
  
  <p>The plane-class:</p>
  
  <pre><code>#include "plane.h"
  
  Plane::Plane( )
  {
  flightNum = "Not set";
  numOfPassengers = -1;
  fuel = -1;
  }
  
  ostream&amp; operator &lt;&lt; ( ostream&amp; os, const Plane&amp; p )
  {
  os &lt;&lt; "Flight Number: " &lt;&lt; p.flightNum
     &lt;&lt; "\nNumber of Passengers " &lt;&lt; p.numOfPassengers
     &lt;&lt; "\nRemaining fuel: " &lt;&lt; p.fuel;
  
  return os;
  }
  bool Plane::operator&gt;(  const Plane&amp; p2) const
  {
   if(this-&gt;fuel&gt;p2.getFuel())
   {
       return true;
    }
   else
   {
       return false;
   }
  }
  ifstream&amp; operator &gt;&gt; ( ifstream&amp; fin, Plane&amp; p )
  {
    fin&gt;&gt;p.flightNum;
    fin&gt;&gt;p.numOfPassengers;
    fin&gt;&gt;p.fuel;
  }
  </code></pre>
  
  <p>The error I am receiving is:</p>
  
  <pre><code> In function ‘int main()’:
  
  welcome.cc:127: error: no matching function for call to ‘std::priority_queue&lt;Plane*,              
  std::vector&lt;Plane*, std::allocator&lt;Plane*&gt; &gt;, std::greater&lt;Plane*&gt; &gt;::push(Plane&amp;)’
  /usr/lib/gcc/i686-redhat-   
  linux/4.4.6/../../../../include/c++/4.4.6/bits/stl_queue.h:509: note: candidates are:   
  void std::priority_queue&lt;_Tp, _Sequence, _Compare&gt;::push(const typename  _Sequence::value_type&amp;) [with _Tp = Plane*, _Sequence = std::vector&lt;Plane*, std::allocator&lt;Plane*&gt; &gt;, _Compare = std::greater&lt;Plane*&gt;]
  welcome.cc:151: error: no match for ‘operator=’ in ‘p = pq.std::priority_queue&lt;_Tp, _Sequence, _Compare&gt;::top [with _Tp = Plane*, _Sequence = std::vector&lt;Plane*, std::allocator&lt;Plane*&gt; &gt;, _Compare = std::greater&lt;Plane*&gt;]()’
  </code></pre>
  
  <p>The requirement of the program is that it needs to add the plane object to the priority queue. The priority is the fuel of the plane.</p>