I wrote the code to overload the + operator to append a book class node to a bookshelf class linked list, and the compiler says there aren't any errors with it. But when I try to add 2 book objects in the main program it says that there "no operator + that matches these operands" and "binary +: no operator found which takes a right-hand operand of type 'book'(or there is no acceptable conversion)". I'm thinking it has something to do with the function headers rather than the actual code, since it won't even compile.
This operator can be used to add a book to a bookshelf.
Let's see what you're trying to add: *head + *newBook;
head is a pointer-to-book, so *head is a book.
newBook is a pointer-to-book, so *newBook is a book.
You wrote an operator that works on a bookshelf and a book.
You're trying to use an operator that works on a book and a book; no such operator exists, hence the compiler complaining.