#include <iostream>

struct T
{
    mutable int x;
    
    T() : x(0) {}
};

void bar(int& x)
{
   x = 42;
}

void foo(const T& t)
{
   bar(t.x);
}

int main()
{
   T t;
   foo(t);
   std::cout << t.x << '\n';
}