title: What am I doing wrong here? Several "no match for operator" errors in my compile
body: <p>These seem to be my only errors. From my understanding, I only needed to overload an operator if I was setting "sortedListClass" equal to another declared "sortedListClass" or if I was asking if they were less than, equal to, not equal to, etc.. but these are user declared... not declared "sortedListClasses" so im confused.. can anyone shed light on these compilation errors? Thanks!</p>
  
  <p>I'll include all of the code I have incase any of it has significance to the errors...</p>
  
  <p>Basically I am dealing with linked lists with structs and pointers..</p>
  
  <p>here is my list.h:</p>
  
  <pre><code>#ifndef LIST_H
  #define LIST_H
  
  struct cities
  {
      string city;    
  };
  typedef cities listItemType;
  typedef struct Node* nodePtr;
  struct Node
  {
      listItemType data;
      nodePtr next;
  };
  
  #endif
  </code></pre>
  
  <p>here is my sortedListClass.h :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  #include "list.h"
  
  
  #ifndef sortedList_Class
  #define sortedList_Class
  
  class sortedListClass
  {
  
      private:
          int size;
          nodePtr Head;
  
      public:
          //Constructors and Destructor
          sortedListClass();
          sortedListClass(const sortedListClass&amp; L);
          ~sortedListClass();
  
          //List operations
          void ListInsert(listItemType NewItem);
          void ListDelete();
          void RetrieveCity();
          void PrintList();
          int ListLength() const;
          bool ListIsEmpty() const;
  }; //End Class
  #endif
  </code></pre>
  
  <p>and here is my sortedListClass.cpp : </p>
  
  <pre><code>//Sorted List Class
  //Contains function definitions for actions towards the cities Linked List
  
  #include "sortedListClass.h"
  #include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;string&gt;
  
  sortedListClass::sortedListClass()
  {
      size = 0;
      Head = NULL;
  }
  
  sortedListClass::sortedListClass(const sortedListClass&amp; List)
  {
      if(List.Head == NULL)
          Head = NULL;
      else
      {
          Head = new Node;
          Head-&gt;data = List.Head-&gt;data;
  
          nodePtr NewPtr = Head;
  
          for(nodePtr OrigPtr = List.Head -&gt; next; OrigPtr != NULL; OrigPtr = OrigPtr-&gt; next)
          {
              NewPtr-&gt; next = new Node;
              NewPtr = NewPtr -&gt; next;
              NewPtr -&gt; data = OrigPtr -&gt; data;
          }
              NewPtr -&gt; next = NULL;
      }
  }
  
  sortedListClass::~sortedListClass()
  {
      bool success;
      while(!ListIsEmpty())
          ListDelete();
  }
  
  bool sortedListClass::ListIsEmpty() const
  {
      return bool( size == 0);
  }
  
  int sortedListClass::ListLength() const
  {
      return size;
  }
  
  void sortedListClass::RetrieveCity()
  {
      string city;
      bool success;
      cout &lt;&lt;"Input a city name: ";
      cin &gt;&gt; city;
      cout &lt;&lt; endl;
      nodePtr cur = Head;
      while(cur != NULL)
      {
          if(cur-&gt;data == city)
          {
              cout &lt;&lt;"This city is found" &lt;&lt; endl;
              success = true;
          }
          cur = cur-&gt;next;
      }
      if(!success)
          cout &lt;&lt;"This city is not served" &lt;&lt; endl;
  
  }
  
  void sortedListClass::PrintList()
  {
      nodePtr cur = Head;
      cout &lt;&lt; "Number of cities: " &lt;&lt; size &lt;&lt; endl;
      while(cur!= NULL)
      {
          cout &lt;&lt;cur-&gt;data;
          cur = cur-&gt;next;
      }
  }
  
  void sortedListClass::ListInsert(listItemType Item)
  {
      nodePtr newNode = new Node;
      newNode -&gt; data = Item;
      newNode-&gt;next = NULL;
      if(Head = NULL)
          Head = newNode;
      else if (Item &lt; Head-&gt;data)
      {
          newNode-&gt;next = Head;
          Head = newNode;
      }
  
      nodePtr curr = Head, prev = Head;
      while((newNode-&gt;data &gt; curr-&gt;data) &amp;&amp; (curr != NULL))
      {
          prev = curr;
          curr = curr -&gt; next;
      }
  
      if(curr-&gt;next == NULL)
      {
          curr-&gt;next = newNode;
          newNode-&gt;next = NULL;
      }
      else if(curr-&gt;data &gt; newNode-&gt;data)
      {
          newNode-&gt;next = curr;
          prev-&gt;next = newNode;
      }
  }
  
  void sortedListClass::ListDelete()
  {
      bool success = false;
      string city;
      cout &lt;&lt; "Enter a city name to delete from the list: " &lt;&lt; endl;
      cin &gt;&gt; city;
      nodePtr p = new Node;
      nodePtr curr, prev;
      curr = Head;
      prev = Head;
      p -&gt; data = city;
      p -&gt; next = NULL;
      if(Head == NULL)
          cout &lt;&lt;"Unable to delete anything, list is empty." &lt;&lt; endl;
      else
      {
          while(curr-&gt;next != NULL)
          {
              if(curr -&gt; data == p -&gt; data)
              {
                  prev-&gt;next = curr-&gt;next;
                  curr-&gt;next = NULL;
                  delete curr;
                  curr = NULL;
                  success = true;
              }
              else
              prev = curr;
              curr = curr-&gt;next;
          }
      }
      if(!success)
          cout &lt;&lt;"This city does not exist. Deletion cannot be performed." &lt;&lt; endl;
  
  }
  </code></pre>
  
  <p>and here is the errors I am getting...</p>
  
  <pre><code>sortedListClass.cpp: In member function ‘void sortedListClass::RetrieveCity()’:
  sortedListClass.cpp:63: error: no match for ‘operator==’ in ‘cur-&gt;Node::data == city’
  sortedListClass.cpp: In member function ‘void sortedListClass::PrintList()’:
  sortedListClass.cpp:81: error: no match for ‘operator&lt;&lt;’ in ‘std::cout &lt;&lt; cur-&gt;Node::data’
  /usr/include/c++/4.4/ostream:108: note: candidates are: std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(std::basic_ostream&lt;_CharT, _Traits&gt;&amp; (*)(std::basic_ostream&lt;_CharT, _Traits&gt;&amp;)) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:117: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(std::basic_ios&lt;_CharT, _Traits&gt;&amp; (*)(std::basic_ios&lt;_CharT, _Traits&gt;&amp;)) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:127: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(std::ios_base&amp; (*)(std::ios_base&amp;)) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:165: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:169: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long unsigned int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:173: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(bool) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/bits/ostream.tcc:91: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(short int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:180: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(short unsigned int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/bits/ostream.tcc:105: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:191: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(unsigned int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:200: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long long int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:204: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long long unsigned int) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:209: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(double) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:213: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(float) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:221: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long double) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/ostream:225: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(const void*) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  /usr/include/c++/4.4/bits/ostream.tcc:119: note:                 std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(std::basic_streambuf&lt;_CharT, _Traits&gt;*) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;]
  sortedListClass.cpp: In member function ‘void sortedListClass::ListInsert(listItemType)’:
  sortedListClass.cpp:93: error: no match for ‘operator&lt;’ in ‘Item &lt; ((sortedListClass*)this)-&gt;sortedListClass::Head-&gt;Node::data’
  sortedListClass.cpp:100: error: no match for ‘operator&gt;’ in ‘newNode-&gt;Node::data &gt; curr-&gt;Node::data’
  sortedListClass.cpp:111: error: no match for ‘operator&gt;’ in ‘curr-&gt;Node::data &gt; newNode-&gt;Node::data’
  sortedListClass.cpp: In member function ‘void sortedListClass::ListDelete()’:
  sortedListClass.cpp:128: error: no match for ‘operator=’ in ‘p-&gt;Node::data = city’
  list.h:5: note: candidates are: cities&amp; cities::operator=(const cities&amp;)
  sortedListClass.cpp:136: error: no match for ‘operator==’ in ‘curr-&gt;Node::data == p-&gt;Node::data’
  [1]+  Done                    scite sortedListClass.cpp
  </code></pre>