A non-const reference is another name for an existing object, so assigning through the reference changes the original value.

Reference Aliases

reference_aliases.cpp
#include <iostream>

int main() {
    int score = ;
    int& alias = score;

    alias += 5;

    std::cout << "score=" << score << std::endl;
    std::cout << "alias=" << alias << std::endl;
    return 0;
}
#include <iostream>

int main() {
    int score = ;
    int& alias = score;

    alias += 5;

    std::cout << "score=" << score << std::endl;
    std::cout << "alias=" << alias << std::endl;
    return 0;
}
#include <iostream>

int main() {
    int score = ;
    int& alias = score;

    alias += 5;

    std::cout << "score=" << score << std::endl;
    std::cout << "alias=" << alias << std::endl;
    return 0;
}
lvalue reference An lvalue reference binds to a named object and acts as an alias for that object.
alias Changing the alias changes the original because both names refer to the same storage.