Do the minimum to make it compile with g++-4.9: use modern names for headers, use const where called for, use correct name for constant, declare a friend class before use.