If Pilot A were to declare an emergency due to entering IMC then he would be entitled to depart from the rules of the air in order to deal with that emergency which would include presumably giving control to Pilot B even if his license was not current. Who could enter it in their log book would probably not seem important.