[relate][get_turns] fixed (GCC) compilation errors (missing include, typename keyword, shadowing of template parameters)