Add intersection function for queues.