Templates: add support for reference objects in parameters.