Util classes are refactored and friend API is provided (#12887).

Change-Id: Id8fb7bd6028c4654f2f204b71d97eb428b33ac8d