You are half-way to an explanation. The getline() doesn't 'steal' anything which was accepted by an earlier cin >>. What it does is use anything which was left over, in the input buffer after that cin, which will usually be a newline character '\n', but if the user typed something other than was requested by the earlier input, there could be many characters remaining.
After cin >> use cin.ignore() or something like cin.ignore(1000, '\n') to get rid of the unwanted characters in the buffer.
doesnt make a difference in this case though (well if its inside the brackets; it cant be immediatly after main like that i believe but int main() { headers and std } is fine)