See how it is done in OffsetArrays.jl
Also, I have asked similar question for custom array types here: