Alternatively, if you want to return something you could create a struct/class which contains the data you want to return.
#include <iostream>
#include <string>
#include <fstream>
struct names {
std::string first_name;
std::string last_name;
};
names read_from_file( std::ifstream &in ) {
names i_names;
in >> i_names.first_name >> i_names.last_name;
return i_names;
}
Probably isn't the best example of how to do it but gives you an idea anyhow.