Post your Counter class definition As one of the comments correctly stated, I can see no way counter sees the same input var.
Edit: then based on your code the fix should be replace in main
getline(cin, input);
with
getline(cin, test.input);
and remove
string input;