As suspected you get the copy by passing the object to operator <<
call-by-value
BankAccount bankAccount; // Default constructor call
cout << "Enter the values to build a new object: " << endl;
cin >> bankAccount; // Read in values
cout << bankAccount; // Create a copy of bankAccount and pass it to operator <<
To avoid this change operator << to
friend ostream &operator<<(ostream &out, const BankAccount &bankAccount ) {
This is call-by-reference and will avoid the copying of the BankAccount object