#include <iostream>
#include <sstream>
#include <string>

struct Customer
{
  std::string name;
  std::string id;
  float loanAmount;
};

std::istream& operator >> (std::istream& is, Customer& cust)
{
    std::getline(is, cust.name); // getline from <string>
    is >> cust.id;
    is >> cust.loanAmount;
    is.ignore(1024, '\n'); // after reading the loanAmount, skip the trailing '\n'
    return is;
}

int main()
{
  std::stringstream ss;

  ss << "Williams, Bill\n"
     << "567382910\n"
     << 380.86f << "\n"
     << "Davidson, Chad\n"
     << "435435435\n"
     << 400.00f;

  Customer c;
  ss >> c;
  std::cout << c.name << "\t" << c.id << "\t" << c.loanAmount << std::endl;

  ss >> c;
  std::cout << c.name << "\t" << c.id << "\t" << c.loanAmount << std::endl;
}
