So if you want to use operator>> and getline with std::cin, then you have to erase the contents of the input buffer if you want to use a getline after an operator>>. But why operator>> leaves the endline character in the input buffer?
#include <iostream>
#include <string>
#include <limits>
int main() {
    std::cout << "Please enter your username:\n";
    std::string username;
    std::cin >> username;
    //delete the value of input buffer
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    std::cout << "Please enter your name:\n";
    std::string fullname;
    getline(std::cin, fullname);
}
