modify moc reader to support friend and template