If the click track is a constant tempo, it's easy. I do this all the time with a songwriting collaborator in England who sends me MP3 files. I listen to the music, set the tempo in Sonar so it's in the ballpark, and turn on the metronome while the reference track plays. Eventually the metronome will lead or lag, and I adjust the tempo to compensate. Once it gets close I go to the end of the song, and adjust the tempo until the clicks like up with the measure markers. This way the beginning is right, the end is right, and any drift is distributed throughout the song and becomes unnoticeable.
It's kind of hard to explain, I hope that made sense...