cpp templates: Fix factory.hpp files

Change-Id: Ie3cc1882797b88bcd909e1940a495963c39db167