Use template instantiation for friend declaration
Fix constness of operator[]
Add missing Url.h include
Use template cast