Try changing this line
toCode:if(title[start] == ' ')
and use this getTitle insteadCode:if ( title.empty() )
as I am pretty sure std::getline() discards the delimiting character.Code:const string& Book::getTitle(string title) { size_t title_start; title_start = title.find("Title:"); if ( title_start == title.npos ) return ""; title = title.substr(title_start); return title; }