The problem was caused by the newline character being consumed by std::getline after using std::cin (i.e. the character inputted when you pressed the ENTER key after using std::cin).
std::cin.ignore(1000, '\n') fixes this issues, as it ignores all characters up to the newline character once the age is entered.
std::cin.clear() clears the error state of the stream in case of bad input (such as a letter entered for age, instead of a number).