Spot the bug in Scores indexing

from Operator overloading
C++23 intermediate 4 min 1 issue to find

The task requires writable indexing and reading through const objects. Find the operator bug.

C++
#include <cstddef>
#include <vector>

class Scores {
    std::vector<int> values_{0, 0, 0};

public:
    int operator[](std::size_t index) {
        return values_.at(index);
    }
};

void award_bonus(Scores& scores) {
    scores[0] = 10;
}
Open in playground
Report an error