title: Operator Overloading - no match for ‘operator!=’ (operand types are
body: <p>I'm fairly new/in the process of learning C++ on a university level and in one of my assignments i keep getting an error that I have no idea how to solve, I'd appreciate it if you veterans and/or geniuses could help me/nudge me in the right direction.</p>
  
  <p>I seem to be having a problem in the implimentation of my class functions, specifically the operator overloads.
  The following is my header file:</p>
  
  <pre><code>#ifndef LIBRARY_H
  #define LIBRARY_H
  
  #include "book.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  class Library;
  
  class Library
  {
      private:
          string name;
          Book** books;
          int librarySize;
          int numBooks;
      public:
          //Constructor, Copy constructor and Destructor
          Library(string a);
          Library(const Library&amp; obj);
          ~Library();
  
          //Operator overloads
          Library&amp; operator+=( Book right);
          Library&amp; operator-=(Book right);
          Library&amp; operator=(const Library &amp;right);
          Library&amp; operator++(int);
          Library&amp; operator--();
  
          //Accessors
          Book* getBook(string);
          bool isFull();
          void print();
  
  
  
  };
  
  #endif
  </code></pre>
  
  <p>And the error seems to be coming from around here in my .cpp file:</p>
  
  <pre><code>#include"library.h"
  #include "book.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  
  
   Library::Library(string a)
  {
      name = a;
  }
  
  Library::Library(const Library&amp; obj)
  {
  
      name = obj.name;
      librarySize = obj.librarySize;
      numBooks = obj.numBooks;
  
      //Copy Books* array
      for(int x=0; x!= librarySize; x++)
          *(books+x) = *(obj.books+x);
  
  }
  //Operator overloads
  Library&amp; Library::operator+=( Book right)
  {
  
      if(numBooks == librarySize)
           cout&lt;&lt;"Library is full!\n";
      else
      {
          numBooks++;     
          *books[numBooks] = right;
      }
      return *this;
  
  }
  
  
  
  Library&amp; Library::operator-=(Book right)
  {
      if(numBooks != 0)
      {
          for(int x=0; x!= numBooks; x++)
          {
              if(*books[x] != right){}
              else
                  *books[x] = "";
          }
      }
      else
          cout&lt;&lt;"Library is empty!\n";
      return *this;
  }
  
  Library&amp; Library::operator=(const Library &amp;right)
  {
  
      name = right.name;
      librarySize = right.librarySize;
      numBooks = right.numBooks;
      for(int x=0; x!= librarySize; x++)
          *(books+x) = *(right.books+x);
      return *this;
  }
  
  Library&amp; Library::operator++(int)
  {
  
      librarySize++;
      return *this;
  
  }
  
  Library&amp; Library::operator--()
  {
  
      if(numBooks == librarySize)
      {   
          *books[numBooks] = right;
          numBooks--;
      }
      librarySize--;
      return *this;
  }
  </code></pre>
  
  <p>I get this as an error followed by a whole lot of "note:"s</p>
  
  <pre><code>root@kali:~/Desktop/Prac3# g++ -std=c++11 -c library.cpp library.h
  library.cpp: In member function ‘Library&amp; Library::operator-=(Book)’:
  library.cpp:48:17: error: no match for ‘operator!=’ (operand types are ‘Book’ and ‘Book’)
  </code></pre>
  
  <p>I have been looking around for answers since the past 2 days but both my profesors and the internet havent given me a solution yet.Ive also tryed different ways of doing the same but i get other errors as well as this one. Though it seems that when i remove the "-=" overload it doesnt give me all the notes, it just gives me the above error.</p>
  
  <p>Thanks in advance.</p>
  
  <p>(I'm new to this whole 'blogging' routine so if i made any netiqette errors or if u need more info please comment prefferably without the bad language :)</p>