a lot of refactoring to achieve uniform syntax.
fixed friend class syntaxes.

Signed-off-by: Tolga HOŞGÖR <fasdfasdas@gmail.com>