Play second, and always make the two piles equal again. Do that every turn and you will win.
Step 1 — try the smallest game: 1 pebble in each pile. Whatever the first player takes, one pebble is left in the other pile, and you take it and win. So the second player wins.
Step 2 — try 2 in each pile. Say the first player takes 1 from a pile, leaving 1 and 2. You take 1 from the other pile, making it 1 and 1 — back to the game you already know you win. If instead they take both from a pile, you take both from the other. Second player wins again.
Step 3 — try 3 in each. Same thing. Copy their move in the other pile, so the piles stay equal.
Step 4 — the rule for 7 and 7.
Let the other player go first.
Whatever they take from one pile, take exactly the same number from the other pile.
The piles are equal after every one of your turns.
An example game:
Why copying works: As long as the piles are equal, there is always something for you to copy — the other pile still has at least as many pebbles as your friend just removed. So you can never get stuck. And you always leave equal piles behind, which means your friend can never leave the table empty. The person who empties it is always you.
Try This: Start with unequal piles, say 5 and 3. Now the first player wins: take 2 from the pile of 5 to make it 3 and 3, and then just copy.