If you and your friend both have pocket queries you can use GPSBabel to combine them into a single query removing all caches that are not common between them.
If you had 2 GPX files; MINE.GPX and YOURS.GPX the following (single) command line will give you only caches that are common to the two.
gpsbabel -i gpx -o gpx -f mine.gpx -f yours.gpx -x stack,push,copy -x duplicate,shortname,all -x stack,swap -x duplicate,shortname -x stack,pop,append -x duplicate,shortname,all -F ours.gpx
GPSBabel is free and can be found here: www.gpsbabel.org