Access behavior / protocol / macro for custom type

You should just need to implement the access behaviour: Access — Elixir v1.20.2