Compile with GCC 4.9.

It seems it doesn't handle inner template friends.
Merge branch 'master' into reorder_pre_post
Fix inner-class friend operators.
Merge branch 'master' into reorder_pre_post