most likely you need to use stringstream class
#include <sstream>
...
...
istream& operator>> (istream& in,Format& b)
{
//cout<<"enter's format";
string word;
string line;
char just;
size_t count=0;
getline( in, line);
stringstream str(line);
while( str >> word )
{
b.add_word(word);
count++;
}
// Not sure about the following
//
cout<<"what justification would you like?"
<<"pick from 'l','r','c'\n";
in>>just;
//cout<<"the value is"<<just<<"\n";
//b.setJustification(just);
in.unget();
for(size_t i=0; i<count; i++)
{
b.add_justif(just);
}
//count=0;
//cout<<"all the words are"<<b;
return in;
}