ambigous overload of istream operator when default constructor used
When I use the default constructor for my book object I get an error trying to compile.
Code:
#include <stdlib.h>
#include "book.h"
#include "author.h"
int main(int argc, char *argv[])
{
map<string,Book> library;
char c;
cout << "Press Enter to Add a Book Q to continue.";
cin.get(c);
while ((c!='Q') && (c!='q')){
Book tempBook();
//error here but if I use Book tempBook("Some Book") no error
//21 C:\Dev-Cpp\Book1\main.cpp ambiguous overload for `std::istream& >> Book (&)()' operator
cin >> tempBook;
library.insert(make_pair(tempBook.get_ISBN(),tempBook));
cout << "Press Enter to Add a Book Q to continue.";
cin.ignore();
cin.get(c);
}
map<string,Book>::iterator pos;
for (pos=library.begin();pos !=library.end();++pos){
cout << "--------------------------------------------\n";
cout <<pos->second;
}
system("PAUSE");
return 0;
}